<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
          
    <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="notice-form">
					<div class="select-list">
						<ul>
#foreach( $field in $fieldList )
#if(${field.matchType}=="any"||${field.matchType}=="eq"||${field.matchType}=="left"||${field.matchType}=="right")
					        <li>
								${field.comment}<input type="text" name="${field.field}" placeholder="请输入${field.comment}" title="请输入${field.comment}">
							</li>
#elseif(${field.matchType}=="select"&&${field.inputType}=="select"&&${field.inputValueTwo}== "")
							<li>
								${field.comment}
								<select name="${field.field}" th:with="type=${@dict.selectDictData('${field.inputValue}')}">
										<option value="">请选择</option>
										<option th:each="e : ${type}" th:text="${e.dictLabel}" th:value="${e.dictValue}"></option>
								</select>
							</li>
#elseif(${field.matchType}=="select"&&${field.inputType}=="select"&&${field.inputValueTwo}!= "")
							<li>
								${field.comment}
								 <select name="${field.field}" th:with="type=${ @${field.inputValueOneU}ServiceImpl.selectAll()}">
								   <option value="">请选择</option>
								   <option th:each="dict : ${type}" th:text="${ dict['${field.inputValueTwoL}']}" th:value="${dict['id']}"></option>
							    </select>
							</li>
#elseif(${field.matchType} == "select"&&${field.inputType} == "radio")
#if(${field.inputValue}== "")
							<li>
								${field.comment}
									 <select id="${field.field}"  name="${field.field}">
										<option value="">请选择</option>
										<option value="0">正常</option>
										<option value="1">禁用</option>
									</select>
							</li>
#else
							<li>
								${field.comment}
									 <select name="${field.field}" th:with="type=${@dict.selectDictData('${field.inputValue}')}">
										<option value="">请选择</option>
										<option th:each="e : ${type}" th:text="${e.dictLabel}" th:value="${e.dictValue}"></option>
								</select>
							</li>
#end
#elseif(${field.matchType}=="numberRange")
							<li>
								${field.comment}
									 <input type="text" name="${field.field}_start" placeholder="起始${field.comment}" title="起始${field.comment}" style="width:46%">
									 <span class="form-control-span-line">-</span>
									 <input type="text" name="${field.field}_end" placeholder="截止${field.comment}" title="截止${field.comment}" style="width:46%;">
							</li>
#elseif(${field.matchType}=="dateRange")
							<li class="select-time">
								<label>${field.comment}</label>
								<input type="text" class="time-input" id="${field.field}Start" placeholder="开始时间" name="params[${field.field}Start]"/>
								<span>-</span>
								<input type="text" class="time-input" id="${field.field}End" placeholder="结束时间" name="params[${field.field}End]"/>
							</li>
#end
#end
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
        
        
        	<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
		        <a class="btn btn-success" onclick="$.operate.addFull()" shiro:hasPermission="${model.modulePackage}:${model.modelL}:add">
		            <i class="fa fa-plus"></i> 新增
		        </a>
		        <a class="btn btn-primary btn-edit disabled" onclick="$.operate.editFull()" shiro:hasPermission="${model.modulePackage}:${model.modelL}:edit">
		            <i class="fa fa-edit"></i> 修改
		        </a>
		        <a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="${model.modulePackage}:${model.modelL}:remove">
		            <i class="fa fa-remove"></i> 删除
		        </a>
		        <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="${model.modulePackage}:${model.modelL}:export">
		            <i class="fa fa-download"></i> 导出
		        </a>
	        </div>
        
 			<div class="col-sm-12 select-table table-striped">
	            <table id="bootstrap-table" data-mobile-responsive="true"></table>
	        </div>
    	</div>
    </div>
    <div th:include="include :: footer"></div> 
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('${model.modulePackage}:${model.modelL}:edit')}]];
        var removeFlag = [[${@permission.hasPermi('${model.modulePackage}:${model.modelL}:remove')}]];
        var detailFlag = [[${@permission.hasPermi('${model.modulePackage}:${model.modelL}:detail')}]];
        
#foreach($field in $fieldList)
#if($field.inputType == "select"&&${field.inputValueTwo} == "") 
        var ${field.field}datas = [[${@dict.selectDictData('${field.inputValue}')}]];
#end
#end
	   
	   var prefix = ctx + "${model.modulePackage}/${model.modelL}"

$(function() {
	var options = {
		    url: prefix + "/list",
		    createUrl: prefix + "/add",
		    updateUrl: prefix + "/edit/{id}",
		    detailUrl: prefix + "/detail/{id}",
		    removeUrl: prefix + "/remove",
		    exportUrl: prefix + "/export",
 		    sortName: "createTime",
 		    modalName: "${model.comment}",
		    search: false,
		    showExport: false,
			columns : [{
	            checkbox: true
	        },
#foreach($field in $fieldList)
#if($field.listShow == true)
#if($field.inputType == "select"&&${field.inputValueTwo} != "")
			{
				field : '${field.inputValueOneL}.${field.inputValueTwoL}', 
				title : '${field.comment}' 
			},
#elseif($field.inputType == "select"&&${field.inputValueTwo} == "")
			{
				field : '${field.field}', 
				title : '${field.comment}' ,
				align: 'center',
				formatter: function(value, row, index) {
					return $.table.selectDictLabel(${field.field}datas, value);
				}
			},
#elseif($field.inputType == "date")
			{
				field : '${field.field}', 
				title : '${field.comment}',
				sortable: true,
				formatter : function(value, row,index) {
						var str = "";
						 str +=value.substring(0,10);
							 return str;
					}
			},
#else
			{
				field : '${field.field}', 
				title : '${field.comment}' 
#if(${field.inputType}=="radio")
				,
	            formatter: function(value, row, index) {
	                if (value == '0') {
	                    return '<span class="badge badge-primary">正常</span>';
	                } else if (value == '1') {
	                    return '<span class="badge badge-danger">禁用</span>';
	                }
	            }
#end
			},
#end
#end
#end
	        {
	            title: '操作',
	            align: 'center',
	            formatter: function(value, row, index) {
	            	var actions = [];
	            	actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="#" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-search"></i>详细</a> ');
					actions.push('<a class="btn btn-primary btn-xs ' + editFlag + '" href="#" onclick="$.operate.editFull(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
					actions.push('<a class="btn btn-warning btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
					return actions.join('');
	            }
	        }]
	   } 
	$.table.init(options);
});
 
    </script>
</body>
</html>